package analyzer;

import java.io.*;
import java.util.ArrayList;

public class fileReader {
public ArrayList<String> ReadFile(String filePath) {
	ArrayList<String> fileTokens = new ArrayList<String>();	
	File file = new File(filePath);
    FileInputStream fis = null;
    BufferedInputStream bis = null;
    DataInputStream dis = null;

	    try {
	      fis = new FileInputStream(file);
	
	      // Here BufferedInputStream is added for fast reading.
	      bis = new BufferedInputStream(fis);
	      dis = new DataInputStream(bis);
	
	      // dis.available() returns 0 if the file does not have more lines.
		      while (dis.available() != 0) {
		
		      // this statement reads the line from the file and print it to
		        // the console.
		        fileTokens.add(dis.readLine());	        
		      }	
	      // dispose all the resources after using them.
	      fis.close();
	      bis.close();
	      dis.close();	
	    } catch (FileNotFoundException e) {
	      e.printStackTrace();
	    } catch (IOException e) {
	      e.printStackTrace();
	    }
	    return fileTokens;
}
}
